<?php

	class Projects extends Zend_Db_Table_Abstract
	{
		protected $_name = 'projects';
		
                
                public function hasProject($name)
                {
                    $select = $this->select()->where('name="'.$name.'"');
                    $result = $this->fetchAll($select)->toArray(); 
                    
                    return $result;
                }
                            
                public function insertProject($adminId,$projectName)
                {
                    $data = array(
                                    'user_id'=>$adminId,
                                    'name' => $projectName,
                                    'creationDate' => date('l js \of F Y h:i:s A')
                    );
                    
                    $this->insert($data);
                }
                
                public function getAll()
                {
                    
                }
                
                public function getByUser($userId)
                {
                    $where =  '`user_id` = "'.$userId.'"';
                    $select = $this->select()->where($where);
                    return ($this->fetchAll($select)->toArray());
                }
	}


